<!DOCTYPE html>
<html lang=zh>
<head>
  <meta charset="utf-8">
  
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-transform" />
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no,email=no,adress=no">
  <!-- Color theme for statusbar -->
  <meta name="theme-color" content="#000000" />
  <!-- 强制页面在当前窗口以独立页面显示,防止别人在框架里调用页面 -->
  <meta http-equiv="window-target" content="_top" />
  <!-- 谷歌收录 -->
  <meta name="google-site-verification" content="-5hl8eC4wfapGZhZouwMVUcKG0iaynijVRJbqVlzXm4" />
  
  
  <title>如何在安卓手机上安装Linux发行版 | 鴻塵</title>
  <meta name="description" content="摘要：废旧的安卓手机root后安装Linux发行版，并在chroot容器中运行。">
<meta property="og:type" content="article">
<meta property="og:title" content="如何在安卓手机上安装Linux发行版">
<meta property="og:url" content="https://hwame.top/20211009/install-linux-on-android-phone.html">
<meta property="og:site_name" content="鴻塵">
<meta property="og:description" content="摘要：废旧的安卓手机root后安装Linux发行版，并在chroot容器中运行。">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211014安装BusyBox.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211014配置LinuxDeploy.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211015安装Debian1.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211015安装Debian2.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724重新安装.jpg?40">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724容器启动和停止.jpg?40">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724远程连接SSH.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101523.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101524.png">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101525.png">
<meta property="article:published_time" content="2021-10-09T15:16:37.000Z">
<meta property="article:modified_time" content="2021-10-15T17:39:10.000Z">
<meta property="article:author" content="鴻塵">
<meta property="article:tag" content="miscellanea">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211014安装BusyBox.png">
  <!-- Canonical links -->
  <link rel="canonical" href="https://hwame.top/20211009/install-linux-on-android-phone.html">
  
    <link rel="alternate" href="true" title="鴻塵" type="application/atom+xml">
  
  
    <link rel="icon" href="/favicon.png" type="image/x-icon">
  
  
<link rel="stylesheet" href="/css/style.css">

  
  
  
    <link href="//cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css" rel="stylesheet">
  
  
<meta name="generator" content="Hexo 5.4.2"></head>


<script src="https://cdn.jsdelivr.net/gh/bobcn/hexo_resize_image.js@master/hexo_resize_image.js"></script>
<body class="main-center theme-purple" itemscope itemtype="http://schema.org/WebPage">
  <header class="header" itemscope itemtype="http://schema.org/WPHeader">
  <div class="slimContent">
    <div class="navbar-header">
      
      
      <div class="profile-block text-center">
        <a id="avatar" href="https://hwame.top" target="_blank">
          <img class="img-circle img-rotate" src="https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg" width="200" height="200">
        </a>
        <h2 id="name" class="hidden-xs hidden-sm">鴻塵</h2>
        <h3 id="title" class="hidden-xs hidden-sm hidden-md">Pythoner, Data Analyst</h3>
        <small id="location" class="text-muted hidden-xs hidden-sm"><i class="icon icon-map-marker"></i> 湖北-武汉</small>
      </div>
      
      <div class="search" id="search-form-wrap">

    <form class="search-form sidebar-form">
        <div class="input-group">
            <input type="text" class="search-form-input form-control" placeholder="搜索" />
            <span class="input-group-btn">
                <button type="submit" class="search-form-submit btn btn-flat" onclick="return false;"><i class="icon icon-search"></i></button>
            </span>
        </div>
    </form>
    <div class="ins-search">
  <div class="ins-search-mask"></div>
  <div class="ins-search-container">
    <div class="ins-input-wrapper">
      <input type="text" class="ins-search-input" placeholder="想要查找什么..." x-webkit-speech />
      <button type="button" class="close ins-close ins-selectable" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
    </div>
    <div class="ins-section-wrapper">
      <div class="ins-section-container"></div>
    </div>
  </div>
</div>


</div>
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#main-navbar" aria-controls="main-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
    </div>
    <nav id="main-navbar" class="collapse navbar-collapse" itemscope itemtype="http://schema.org/SiteNavigationElement" role="navigation">
      <ul class="nav navbar-nav main-nav menu-highlight">
        
        
        <li class="menu-item menu-item-home">
          <a href="/.">
            
            <i class="icon icon-home-fill"></i>
            
            <span class="menu-title">首页</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-archives">
          <a href="/archives">
            
            <i class="icon icon-archives-fill"></i>
            
            <span class="menu-title">归档</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-categories">
          <a href="/categories">
            
            <i class="icon icon-folder-open"></i>
            
            <span class="menu-title">分类</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-tags">
          <a href="/tags">
            
            <i class="icon icon-tags"></i>
            
            <span class="menu-title">标签</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-repository">
          <a href="/repository">
            
            <i class="icon icon-project"></i>
            
            <span class="menu-title">资源</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-gallery">
          <a href="/gallery">
            
            <i class="icon icon-delicious"></i>
            
            <span class="menu-title">相册</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-links">
          <a href="/links">
            
            <i class="icon icon-friendship"></i>
            
            <span class="menu-title">友链</span>
          </a>
        </li>
        
        
        <li class="menu-item menu-item-about">
          <a href="/about">
            
            <i class="icon icon-cup-fill"></i>
            
            <span class="menu-title">关于</span>
          </a>
        </li>
        
      </ul>
      
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/hwame" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/hwamei" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://www.zhihu.com/people/hwame" target="_blank" title="Zhihu" data-toggle=tooltip data-placement=top><i class="icon icon-zhihu"></i></a></li>
        
        <li><a href="https://segmentfault.com/u/hwame" target="_blank" title="Segmentfault" data-toggle=tooltip data-placement=top><i class="icon icon-segmentfault"></i></a></li>
        
        <li><a href="https://gitee.com/hwame" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    </nav>
  </div>
</header>

  
    <aside class="sidebar" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    
      <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-stackexchange"></i>公告</h3>
    <div class="widget-body">
        <div id="board">
            <div class="content">
                <p>欢迎来到鴻塵的博客!<br>鴻塵的<u><a target="_blank" rel="noopener" href="https://weibo.com/hwamei" style="color:#E541E5;">微博</a></u>主页，鴻塵的<u><a target="_blank" rel="noopener" href="https://github.com/hwame" style="color:#E541E5;">Github</a></u>主页，如果我可以忘记的<u><a target="_blank" rel="noopener" href="https://www.zhihu.com/people/hwame" style="color:#E541E5;">知乎</a></u>主页。</p>
            </div>
        </div>
    </div>
</div>

    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-tags"></i>标签云</h3>
    <div class="widget-body tagcloud">
      <a href="/tags/CentOS/" style="font-size: 13px; color: #fff">CentOS</a> <a href="/tags/Go/" style="font-size: 13.2px; color: #fff">Go</a> <a href="/tags/Hexo/" style="font-size: 13.8px; color: #fff">Hexo</a> <a href="/tags/Linux/" style="font-size: 14px; color: #fff">Linux</a> <a href="/tags/Linux%E9%83%A8%E7%BD%B2/" style="font-size: 13px; color: #fff">Linux部署</a> <a href="/tags/MongoDB/" style="font-size: 13.4px; color: #fff">MongoDB</a> <a href="/tags/Spark/" style="font-size: 13px; color: #fff">Spark</a> <a href="/tags/matplotlib/" style="font-size: 13.2px; color: #fff">matplotlib</a> <a href="/tags/miscellanea/" style="font-size: 13.6px; color: #fff">miscellanea</a> <a href="/tags/python/" style="font-size: 14px; color: #fff">python</a> <a href="/tags/shell/" style="font-size: 13.6px; color: #fff">shell</a> <a href="/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/" style="font-size: 13px; color: #fff">大数据</a> <a href="/tags/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/" style="font-size: 13px; color: #fff">数据结构与算法</a> <a href="/tags/%E7%88%AC%E8%99%AB/" style="font-size: 13px; color: #fff">爬虫</a>
    </div>
  </div>

<script type="text/javascript">
    var everytag=document.getElementsByClassName("widget-body tagcloud")[0].children;
    for (var i = everytag.length - 1; i >= 0; i--) {
    	var r=Math.floor(Math.random()*255);
        var g=Math.floor(Math.random()*255);
        var b=Math.floor(Math.random()*255);
        everytag[i].style.background = "rgb("+r+","+g+","+b+")";
    }
</script>
    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-folder-open"></i>分类</h3>
    <div class="widget-body">
      <ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Go/">Go</a><span class="category-list-count">2</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Hexo/">Hexo</a><span class="category-list-count">5</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/MongoDB/">MongoDB</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/miscellanea/">miscellanea</a><span class="category-list-count">4</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/python/">python</a><span class="category-list-count">7</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E4%B8%8E%E7%AE%97%E6%B3%95/">数据结构与算法</a><span class="category-list-count">1</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-archives-fill"></i>归档</h3>
    <div class="widget-body">
      <ul class="archive-list"><li class="archive-list-item"><a class="archive-list-link" href="/archives/2022/">2022</a><span class="archive-list-count">4</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2021/">2021</a><span class="archive-list-count">9</span></li><li class="archive-list-item"><a class="archive-list-link" href="/archives/2020/">2020</a><span class="archive-list-count">17</span></li></ul>
    </div>
  </div>


    
      
  <div class="widget">
    <h3 class="widget-title"><i style="color:#9400D3" class="icon icon-shu-fill"></i>最新文章</h3>
    <div class="widget-body">
      <ul class="recent-post-list list-unstyled ">
        
          <li>
            
            <div class="item-thumb">
              <a href="/20220327/channel-and-goroutine-in-go.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/icon-golang.jpeg)" alt="Go语言中的通道" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Go/">Go</a>
              </p>
              <p class="item-title">
                <a href="/20220327/channel-and-goroutine-in-go.html" class="title">Go语言中的通道</a>
              </p>
              <p class="item-date">
                <time datetime="2022-03-27T11:06:16.000Z" itemprop="datePublished">2022-03-27</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220323/when-to-use-pointer-in-go.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/icon-golang.jpeg)" alt="Go语言什么时候使用指针" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Go/">Go</a>
              </p>
              <p class="item-title">
                <a href="/20220323/when-to-use-pointer-in-go.html" class="title">Go语言什么时候使用指针</a>
              </p>
              <p class="item-date">
                <time datetime="2022-03-23T12:49:57.000Z" itemprop="datePublished">2022-03-23</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220228/awesome-images-in-markdown.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg)" alt="Markdown中图片的高级用法" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/miscellanea/">miscellanea</a>
              </p>
              <p class="item-title">
                <a href="/20220228/awesome-images-in-markdown.html" class="title">Markdown中图片的高级用法</a>
              </p>
              <p class="item-date">
                <time datetime="2022-02-28T15:27:50.000Z" itemprop="datePublished">2022-02-28</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20220116/shell-regular-expression.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/post-pics/linux-icon.png)" alt="Shell正则表达式" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/Linux/">Linux</a>
              </p>
              <p class="item-title">
                <a href="/20220116/shell-regular-expression.html" class="title">Shell正则表达式</a>
              </p>
              <p class="item-date">
                <time datetime="2022-01-16T14:13:05.000Z" itemprop="datePublished">2022-01-16</time>
              </p>
            </div>
          </li>
          
          <li>
            
            <div class="item-thumb">
              <a href="/20211009/install-linux-on-android-phone.html" class="thumb">
    
    
        <span style="background-image:url(https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg)" alt="如何在安卓手机上安装Linux发行版" class="thumb-image"></span>
    
</a>

            </div>
            
            <div class="item-inner">
              <p class="item-category">
                <a class="category-link" href="/categories/miscellanea/">miscellanea</a>
              </p>
              <p class="item-title">
                <a href="/20211009/install-linux-on-android-phone.html" class="title">如何在安卓手机上安装Linux发行版</a>
              </p>
              <p class="item-date">
                <time datetime="2021-10-09T15:16:37.000Z" itemprop="datePublished">2021-10-09</time>
              </p>
            </div>
          </li>
          
      </ul>
    </div>
  </div>
  

    
  </div>
</aside>

  
  
<aside class="sidebar sidebar-toc collapse" id="collapseToc" itemscope itemtype="http://schema.org/WPSideBar">
  <div class="slimContent">
    <nav id="toc" class="article-toc">
      <h3 class="toc-title">文章目录</h3>
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#1-%E5%89%8D%E8%A8%80"><span class="toc-number">1.</span> <span class="toc-text">1.前言</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#2-%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C"><span class="toc-number">2.</span> <span class="toc-text">2.准备工作</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#3-%E5%AE%89%E8%A3%85Debian%E7%B3%BB%E7%BB%9F"><span class="toc-number">3.</span> <span class="toc-text">3.安装Debian系统</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-1-%E9%85%8D%E7%BD%AELinuxDeploy"><span class="toc-number">3.1.</span> <span class="toc-text">3.1.配置LinuxDeploy</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-%E5%AE%89%E8%A3%85%E8%BF%87%E7%A8%8B"><span class="toc-number">3.2.</span> <span class="toc-text">3.2.安装过程</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-3-%E5%AE%B9%E5%99%A8%E7%9A%84%E5%90%AF%E5%8A%A8%E4%B8%8E%E5%81%9C%E6%AD%A2"><span class="toc-number">3.3.</span> <span class="toc-text">3.3.容器的启动与停止</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-4-%E8%BF%9E%E6%8E%A5%E4%BD%BF%E7%94%A8Linux"><span class="toc-number">3.4.</span> <span class="toc-text">3.4.连接使用Linux</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#4-%E5%AE%89%E8%A3%85CentOS%E7%B3%BB%E7%BB%9F"><span class="toc-number">4.</span> <span class="toc-text">4.安装CentOS系统</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-%E6%96%B0%E5%BB%BALinuxDeploy%E9%85%8D%E7%BD%AE"><span class="toc-number">4.1.</span> <span class="toc-text">4.1.新建LinuxDeploy配置</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-2-%E9%85%8D%E7%BD%AELinuxDeploy"><span class="toc-number">4.2.</span> <span class="toc-text">4.2.配置LinuxDeploy</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-3-%E5%AE%89%E8%A3%85CentOS%E7%B3%BB%E7%BB%9F"><span class="toc-number">4.3.</span> <span class="toc-text">4.3.安装CentOS系统</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-4-%E5%90%AF%E5%8A%A8%E5%81%9C%E6%AD%A2%E4%B8%8E%E4%BD%BF%E7%94%A8"><span class="toc-number">4.4.</span> <span class="toc-text">4.4.启动停止与使用</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#5-%E9%99%84%E4%BB%B6"><span class="toc-number">5.</span> <span class="toc-text">5.附件</span></a></li></ol>
    </nav>
  </div>
</aside>

<main class="main" role="main">
  <div class="content">
  <article id="post-install-linux-on-android-phone" class="article article-type-post" itemscope itemtype="http://schema.org/BlogPosting">
    
    <div class="article-header">
      
        
  
    <h1 class="article-title" itemprop="name">
      如何在安卓手机上安装Linux发行版
    </h1>
  

      
      <div class="article-meta">
        <span class="article-date">
    <i class="icon icon-calendar"></i>
	<a href="/20211009/install-linux-on-android-phone.html" class="article-date">
	  发布于 <time datetime="2021-10-09T15:16:37.000Z" itemprop="datePublished">2021-10-09</time>
	</a>
</span>
<span class="article-date">
    <i class="icon icon-calendar-check"></i>
	<a href="/20211009/install-linux-on-android-phone.html" class="article-date">
	  更新于 <time datetime="2021-10-15T17:39:10.000Z" itemprop="dateUpdated">2021-10-16</time>
	</a>
</span>
        
  <span class="article-category">
    <i class="icon icon-folder"></i>
    <a class="article-category-link" href="/categories/miscellanea/">miscellanea</a>
  </span>

        
  <span class="article-tag">
    <i class="icon icon-tags"></i>
	<a class="article-tag-link-link" href="/tags/miscellanea/" rel="tag">miscellanea</a>
  </span>


        

	<span class="article-read hidden-xs">
    	<i class="icon icon-eye-fill" aria-hidden="true"></i>
    	<span id="/20211009/install-linux-on-android-phone.html" class="leancloud_visitors"  data-flag-title="如何在安卓手机上安装Linux发行版">
			<span class="leancloud-visitors-count">0</span>
		</span>
    </span>

        <span class="post-comment"><i class="icon icon-comment"></i> <a href="/20211009/install-linux-on-android-phone.html#comments" class="article-comment-link">评论</a></span>
        
	
		<span class="post-wordcount hidden-xs" itemprop="wordCount">字数统计: 2.7k(字)</span>
	
	
		<span class="post-readcount hidden-xs" itemprop="timeRequired">阅读时长: 9(分)</span>
	

      </div>
      <div style="background-color:#D7BDE2;border:1px solid #D7BDE2;border-radius:10px;padding:5px">
          <b>温馨提示</b>：点击页面下方<i style="color:red" class="icon icon-anchor"></i>以展开或折叠目录
      </div>
    </div>
    <div class="article-entry marked-body" itemprop="articleBody">
      
        <p>摘要：废旧的安卓手机root后安装Linux发行版，并在chroot容器中运行。<span id="more"></span></p>
<blockquote>
<p><font size=5><b>文章说明</b></font><br><strong>文章作者：</strong><a href="https://hwame.top">鴻塵</a><br><strong>文章链接：</strong><a href="https://hwame.top/20211009/install-linux-on-android-phone.html">https://hwame.top/20211009/install-linux-on-android-phone.html</a><br><strong>文章说明：</strong>root手机上安装Linux系统，我折腾过很长的一段时间，查阅参考了很多文章，由于时间跨度较大，参考资料可能不全。<br><strong>参考资料：</strong></p>
<ul>
<li><a target="_blank" rel="noopener" href="https://www.hannahtech.co/post/turn-your-old-cracked-android-phone-into-a-backup-server-urbackup-linux-deploy-tutorial-part-i">Turn Your Old, Cracked Android Phone Into a Backup Server!</a></li>
<li><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/077ceebb4f81">安卓手机装centos 当服务器 Linux deploy 超详细入门教程</a></li>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_43436873/article/details/105418651">Linux Deploy 安装centos-altarch</a></li>
</ul>
</blockquote>
<h2 id="1-前言"><a href="#1-前言" class="headerlink" title="1.前言"></a>1.前言</h2><p>在已root手机上安装Linux发行版，我曾做过很多尝试，成功失败的都有，但是即使成功也是安装的Debian系的，RedHat系从未成功过。</p>
<p>写这篇文章时看了看电脑里的资料，发现早在2020年的6月就已经开始尝试了，那时候正是暑假没开学疫情在家没事干的时候，恰好手上有一台完全root的安卓手机。但那时候不是刚利用学生身份白嫖了阿里云的1M2H4G服务器吗，虽然说半年之后因为「考试」没过不能续期半年而没法白嫖到一年……</p>
<p>没有了学生身份之后，购买云服务器的价格是越来越贵了，不管是阿里云还是腾讯云。我寻思着能不能找到什么替代品，这让我想起之前在知乎不经意看到的，可以把Android手机改造成Linux。</p>
<font color=purple><b>✉本文也是一边摸索一边采坑，才成功安装上不同的Linux发行版，建议同时参考Debian和CentOS的「配置LinuxDeploy」部分。</b></font>


<h2 id="2-准备工作"><a href="#2-准备工作" class="headerlink" title="2.准备工作"></a>2.准备工作</h2><ul>
<li>root手机，需要获得系统级Root权限。<strong>注意</strong>，未获取Root权限的手机可通过Termux作为替代软件，从而在手机上安装Linux，但是很多Linux命令将无法使用，不过运行个python命令行还是可以的【未验证，自行尝试】。</li>
<li>需要连接网络，最好与电脑处于同一无线局域网，这样就可以在电脑上通过SecureCRT/XShell之类的软件进行连接；</li>
<li>手机上安装<code>Linux deploy</code>（必需）、<code>BusyBox</code>（必需），<code>JuiceSSH</code>（可选但建议），<code>RootExplorer</code>（可选），各软件作用如下：<ul>
<li><a target="_blank" rel="noopener" href="https://github.com/meefik/busybox/releases">BusyBox</a>（需要Root权限）：用于扩展Android手机命令，因为在这装Linux之后，很多Linux命令都是没有的；</li>
<li><a target="_blank" rel="noopener" href="https://github.com/meefik/linuxdeploy/releases">Linux deploy</a>（需要Root权限）：作为装载Linux系统的容器；</li>
<li>JuiceSSH：手机终端通过SSH连接Linux。</li>
<li>RootExplorer（需要Root权限）：强大的文件管理器，可操作系统文件、精简系统。</li>
</ul>
</li>
<li>安装BusyBox：打开BusyBox软件，可以看到状态为<code>*not installed</code>，点击右下方<code>INSTALL</code>，按提示赋予ROOT权限即可安装，如图所示：<br><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211014安装BusyBox.png" alt="安装BusyBox"></li>
</ul>
<h2 id="3-安装Debian系统"><a href="#3-安装Debian系统" class="headerlink" title="3.安装Debian系统"></a>3.安装Debian系统</h2><h3 id="3-1-配置LinuxDeploy"><a href="#3-1-配置LinuxDeploy" class="headerlink" title="3.1.配置LinuxDeploy"></a>3.1.配置LinuxDeploy</h3><p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211014配置LinuxDeploy.png" alt="配置LinuxDeploy"></p>
<p>打开Linux Deploy软件，首页可见简要安装步骤（如上图1）。点击首页右下角的「设置图标」进行如下配置（建议「引导设置」中的配置项「本地化」设置为<code>zh_CN.UTF-8</code>）：</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">类别</th>
<th style="text-align:center">配置项</th>
<th style="text-align:center">属性</th>
<th style="text-align:left">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">发行版GNU/Linux</td>
<td style="text-align:center">Debian</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">架构</td>
<td style="text-align:center"><code>arm64</code></td>
<td style="text-align:left">安装BusyBox时的architecture，没有就选最接近的</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">发行版GNU/Linux版本</td>
<td style="text-align:center"><code>buster</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">源地址</td>
<td style="text-align:center"><a target="_blank" rel="noopener" href="http://ftp.debian.org/debian/">http://ftp.debian.org/debian/</a></td>
<td style="text-align:left">可更换国内镜像源</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">安装类型</td>
<td style="text-align:center">镜像文件</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">安装路径</td>
<td style="text-align:center"><code>/storage/emulated/0/linux.img</code></td>
<td style="text-align:left">可命名为<code>debian.img</code>以示区别</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">镜像大小</td>
<td style="text-align:center">自动分配</td>
<td style="text-align:left">默认为2GB，可修改</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">文件系统</td>
<td style="text-align:center"><code>ext4</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">用户名</td>
<td style="text-align:center"><code>root</code></td>
<td style="text-align:left">默认<code>android</code></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">用户密码</td>
<td style="text-align:center"><code>****</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">初始化</td>
<td style="text-align:center">启用</td>
<td style="text-align:center">☑️</td>
<td style="text-align:left">貌似可不选</td>
</tr>
<tr>
<td style="text-align:center">初始化</td>
<td style="text-align:center">初始化系统</td>
<td style="text-align:center"><code>sysv</code></td>
<td style="text-align:left">貌似可不选</td>
</tr>
<tr>
<td style="text-align:center">挂载</td>
<td style="text-align:center">启用</td>
<td style="text-align:center">☑️</td>
<td style="text-align:left">貌似可不选</td>
</tr>
<tr>
<td style="text-align:center">SSH</td>
<td style="text-align:center">启用</td>
<td style="text-align:center">☑️</td>
<td style="text-align:left"><strong>必选</strong></td>
</tr>
</tbody>
</table>
</div>
<p>配置完成后返回首页，点击左上角菜单图标，选择设置（如上图2），配置「<code>环境</code>」项。其中，「<code>ENV目录</code>」默认即可，「<code>PATH变量</code>」设置为「<code>/system/xbin</code>」，然后点击「<code>更新环境</code>」来更新操作环境（如上图3）。</p>
<h3 id="3-2-安装过程"><a href="#3-2-安装过程" class="headerlink" title="3.2.安装过程"></a>3.2.安装过程</h3><p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211015安装Debian1.png" alt="Debian安装过程1"></p>
<p>更新完操作环境后，回到Linux Deploy主页，点击右上角选项图标 ，选择「安装」，按提示赋予ROOT权限即可开始安装（如上图1）。首先是系统和分区、软件包的Retrieving和Validating（如上图2），然后是Extracting、Unpacking、Configuring（如上图3），接着下载安装其他必要软件（如下图1、2），最后是Setting up、Creating、Processing，配置好<code>extra/ssh</code>后则部署完成（如下图3）。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20211015安装Debian2.png" alt="Debian安装过程2"></p>
<p>至此，Debian安装部署完成，第一次部署需要安装的软件很多，因此输出的日志很多很杂，「<code>&gt;&gt;&gt; deploy</code>」和「<code>&lt;&lt;&lt; deploy</code>」之间的输出即安装部署时的日志，如果失败则可从中检查。初次安装花费5分钟左右的时间，这取决于网速，例如此处运行时间为<code>[09:51:02]</code>～<code>[09:55:07]</code>。第二次再点安装时则只用了10秒，程序做必要的检查、软件的更新：<code>[11:55:29] 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded</code>，如下图。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724重新安装.jpg?40" alt="重新安装"></p>
<h3 id="3-3-容器的启动与停止"><a href="#3-3-容器的启动与停止" class="headerlink" title="3.3.容器的启动与停止"></a>3.3.容器的启动与停止</h3><p>安装完成后即可启动、连接、使用了。在Linux Deploy主页下方点击「启动」和「停止」即可完成服务器对应的操作，日志也会同步输出对应「<code>&gt;&gt;&gt; start</code> / <code>&lt;&lt;&lt; start</code>」和「<code>&gt;&gt;&gt; stop</code> / <code>&lt;&lt;&lt; stop</code>」的信息，如图所示。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724容器启动和停止.jpg?40" alt="容器启动和停止"></p>
<p><strong>注意：</strong>初次安装完成后，应先点击「停止」进行分区及系统的卸载，然后重新点击「启动」。</p>
<h3 id="3-4-连接使用Linux"><a href="#3-4-连接使用Linux" class="headerlink" title="3.4.连接使用Linux"></a>3.4.连接使用Linux</h3><p>保持Linux处于 <strong>启动</strong> 状态，则可以通过SSH软件进行连接，例如<code>Juice SSH</code>、<code>X Shell</code>和<code>Secure CRT</code>等。</p>
<p>例如在同一局域网下，电脑IP为<code>192.168.0.104</code>，手机（Linux主机）IP为<code>192.168.0.107</code>，则可以进行连接，如图是使用命令行进行ssh连接。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/20210724远程连接SSH.png" alt="远程连接SSH"></p>
<p>【说明：】①貌似连接10分钟无操作则自动断开；②图示ssh命令第一次连接时会提示；③推荐使用专门软件，命令行过于简陋。</p>
<h2 id="4-安装CentOS系统"><a href="#4-安装CentOS系统" class="headerlink" title="4.安装CentOS系统"></a>4.安装CentOS系统</h2><h3 id="4-1-新建LinuxDeploy配置"><a href="#4-1-新建LinuxDeploy配置" class="headerlink" title="4.1.新建LinuxDeploy配置"></a>4.1.新建LinuxDeploy配置</h3><p>上面安装的Debian系统是在7月24日完成的，很多「非必要修改」的东西都是保持默认，比如镜像源、安装路径等配置项。</p>
<p>由于要安装CentOS，为了保留Debian和CentOS两者的配置，故新建一个配置文件而不是覆盖修改原来的Debian的配置。</p>
<p>在LinuxDeploy软件首页点击左上角菜单图标 ，选择配置文件，新建一个名称为<code>Centos</code>的配置文件。为了以示区别，将默认名称<code>Linux</code>修改为<code>Debian</code>。</p>
<p>选择Centos配置文件后返回主界面，点击左上角菜单图标 ，选择设置 ，配置「环境」项，与3.1节安装Debian系统时的<a href="#3-1-%E9%85%8D%E7%BD%AELinuxDeploy">配置LinuxDeploy</a>相同，不再赘述。</p>
<h3 id="4-2-配置LinuxDeploy"><a href="#4-2-配置LinuxDeploy" class="headerlink" title="4.2.配置LinuxDeploy"></a>4.2.配置LinuxDeploy</h3><p>打开Linux Deploy，首页可见简要安装步骤。点击右下角的设置图标 进行如下配置：</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">类别</th>
<th style="text-align:center">配置项</th>
<th style="text-align:center">属性</th>
<th style="text-align:left">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">发行版GNU/Linux</td>
<td style="text-align:center">Centos</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">架构</td>
<td style="text-align:center"><code>aarch64</code></td>
<td style="text-align:left">安装BusyBox时的architecture</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">发行版GNU/Linux版本</td>
<td style="text-align:center"><code>7</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">源地址</td>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://mirrors.bfsu.edu.cn/centos-altarch/">https://mirrors.bfsu.edu.cn/centos-altarch/</a></td>
<td style="text-align:left">清华源失败才换此源</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">安装类型</td>
<td style="text-align:center">镜像文件</td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">安装路径</td>
<td style="text-align:center"><code>/storage/emulated/0/centos.img</code></td>
<td style="text-align:left">与<code>debian.img</code>相区别</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">镜像大小</td>
<td style="text-align:center">自动分配</td>
<td style="text-align:left">默认为2GB，可修改</td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">文件系统</td>
<td style="text-align:center"><code>ext4</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">用户名</td>
<td style="text-align:center"><code>android</code></td>
<td style="text-align:left">默认<code>android</code></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">用户密码</td>
<td style="text-align:center"><code>****</code></td>
<td style="text-align:left"></td>
</tr>
<tr>
<td style="text-align:center">引导设置</td>
<td style="text-align:center">本地化</td>
<td style="text-align:center"><code>zh_CN.UTF-8</code></td>
<td style="text-align:left">默认为<code>C</code></td>
</tr>
<tr>
<td style="text-align:center">SSH</td>
<td style="text-align:center">启用</td>
<td style="text-align:center">☑️</td>
<td style="text-align:left"><strong>必选</strong></td>
</tr>
</tbody>
</table>
</div>
<p><strong>说明：</strong></p>
<ul>
<li>①镜像源地址是最容易出错的地方，就笔者环境而言：官方源速度慢不稳定，清华源卡会在某一步动不了（原因是否是用户名设置为<code>root</code>还是启用初始化/挂载未知），阿里源没有<code>altarch</code>分支，故选择<a target="_blank" rel="noopener" href="https://mirrors.bfsu.edu.cn/centos-altarch/">北京外国语大学镜像站</a>（只有这个才能成功安装CentOS）。</li>
<li>②因猜测清华源<code>root</code>用户名原因，故将用户名改为<code>android</code>而未直接设置<code>root</code>。待系统安装成功后，可删除<code>android</code>用户。</li>
<li>③镜像大小为0时即自动分配，默认只有2GB，若修改大小则需重装系统。</li>
</ul>
<h3 id="4-3-安装CentOS系统"><a href="#4-3-安装CentOS系统" class="headerlink" title="4.3.安装CentOS系统"></a>4.3.安装CentOS系统</h3><p>在Linux Deploy主页，点击右上角选项图标，选择「安装」，按提示赋予ROOT权限即可开始安装。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101523.png" alt="安装CentOS系统1"></p>
<p>首先是<code>bootstrap/rootfs</code>的安装（快），然后是<code>bootstrap/centos</code>的安装（慢），如上图1。<br>经过软件包的Retrieving和Resolving Dependencies（如上图1、2），软件依赖分析完成后将列出待安装软件的信息（包名、架构、版本、仓库、大小），如上图3。</p>
<p>Transaction Summary列出待安装的57个安装包（Package）和87个依赖包（Dependent package），如下图1。随即开始软件包的下载（Downloading）、安装（Installing）和校验（Verifying），安装校验过程可以看到当前进度，如下图1、2。完成后将列出已安装的软件，如下图3。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101524.png" alt="安装CentOS系统2"></p>
<p>接下来是一系列配置，关键是<code>extra/ssh</code>的安装和配置（几乎所有的失败都是这里的问题），如下图1。这项安装配置将会额外安装<code>openssh-server</code>，如下图2。安装完成后自动配置好<code>extra/ssh</code>则部署完成，如下图3。</p>
<p><img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/2021101525.png" alt="安装CentOS系统3"></p>
<p>注意到，在上图1中配置完<code>core/locale</code>本地化后界面语言就变成中文了，这得益于「引导设置」中的配置项「本地化」设置为<code>zh_CN.UTF-8</code>。</p>
<p>至此，CentOS安装部署完成，第一次部署需要安装的软件很多，因此输出的日志很多很杂，「<code>&gt;&gt;&gt; deploy</code>」和「<code>&lt;&lt;&lt; deploy</code>」之间的输出即安装部署时的日志，如果失败则可根据日志信息检查。初次安装花费5分钟左右的时间，这取决于网速，例如此处运行时间为<code>[08:44:47]</code>～<code>[08:49:14]</code>。</p>
<h3 id="4-4-启动停止与使用"><a href="#4-4-启动停止与使用" class="headerlink" title="4.4.启动停止与使用"></a>4.4.启动停止与使用</h3><p>同Debian，不再赘述。</p>
<h2 id="5-附件"><a href="#5-附件" class="headerlink" title="5.附件"></a>5.附件</h2><p>必不可少的安卓软件：</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">名称</th>
<th style="text-align:center">版本</th>
<th style="text-align:center">大小</th>
<th style="text-align:center">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://github.com/meefik/busybox/releases">BusyBox</a></td>
<td style="text-align:center">1.31.1</td>
<td style="text-align:center">5.21MB</td>
<td style="text-align:center">Github下载，1年未更新</td>
</tr>
<tr>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://github.com/meefik/linuxdeploy/releases">Linux deploy</a></td>
<td style="text-align:center">2.6.0</td>
<td style="text-align:center">10.1MB</td>
<td style="text-align:center">Github下载，1年未更新</td>
</tr>
</tbody>
</table>
</div>
<p>可选但强烈建议安装的安卓软件：</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">名称</th>
<th style="text-align:center">版本</th>
<th style="text-align:center">大小</th>
<th style="text-align:center">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://juicessh-builds.s3.amazonaws.com/juicessh-v3.2.2_200.apk">JuiceSSH</a></td>
<td style="text-align:center">3.2.2</td>
<td style="text-align:center">23.6MB</td>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://juicessh.com/">JuiceSSH官网</a>下载，最新版于2021-01-30</td>
</tr>
</tbody>
</table>
</div>
<p>安装日志文件可作为安装参考、查错依据，若与以下日志不同则可对比来定位问题。</p>
<div class="table-container">
<table>
<thead>
<tr>
<th style="text-align:center">名称</th>
<th style="text-align:center">Linux发行版</th>
<th style="text-align:center">版本</th>
<th style="text-align:center">大小</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/linux-debian.log">linux-debian.log</a></td>
<td style="text-align:center">Debian</td>
<td style="text-align:center">buster</td>
<td style="text-align:center">41.0KB</td>
</tr>
<tr>
<td style="text-align:center"><a target="_blank" rel="noopener" href="https://cdn.jsdelivr.net/gh/hwame/pics@main/miscellanea/linux-centos.log">linux-centos.log</a></td>
<td style="text-align:center">CentOS</td>
<td style="text-align:center">7</td>
<td style="text-align:center">85.6KB</td>
</tr>
</tbody>
</table>
</div>

      
    </div>
    <div class="article-footer">
      <blockquote class="mt-2x">
  <ul class="post-copyright list-unstyled">
    <li class="post-copyright-license">
      <strong>文章作者： </strong><a href="https://hwame.top" style="color:#E541E5;"> 鴻塵</a>
    </li>
    
    <li class="post-copyright-link hidden-xs">
      <strong>本文链接：</strong>
      <a href="https://hwame.top/20211009/install-linux-on-android-phone.html" title="如何在安卓手机上安装Linux发行版" target="_blank" rel="external" style="color:#E541E5;">https://hwame.top/20211009/install-linux-on-android-phone.html</a>
    </li>
    
    <li class="post-copyright-license">
      <strong>版权声明： </strong> 本博客所有文章除特别声明外，均采用《<a href="http://creativecommons.org/licenses/by/4.0/deed.zh" target="_blank" rel="external" style="color:#E541E5;"><u>CC BY 4.0 CN协议</u></a>》许可协议。转载请注明出处！
    </li>
  </ul>
</blockquote>


<div class="panel panel-default panel-badger">
  <div class="panel-body">
    <figure class="media">
      <div class="media-left">
        <a href="https://hwame.top" target="_blank" class="img-burn thumb-sm visible-lg">
          <img src="https://cdn.jsdelivr.net/gh/hwame/pics@main/avatar.jpg" class="img-rounded w-full" alt="">
        </a>
      </div>
      <div class="media-body">
        <h3 class="media-heading"><a href="https://hwame.top" target="_blank"><span class="text-dark">鴻塵</span><small class="ml-1x">Pythoner, Data Analyst</small></a></h3>
        <div>个人简介：处女座不适合做码农。</div>
      </div>
    </figure>
  </div>
</div>


    </div>
  </article>
  
    
  <section id="comments">
  	
      <div id="vcomments"></div>
    
  </section>


  
</div>

  <nav class="bar bar-footer clearfix" data-stick-bottom>
  <div class="bar-inner">
  
  <ul class="pager pull-left">
    
    <li class="prev">
      <a href="/20220116/shell-regular-expression.html" title="Shell正则表达式"><i class="icon icon-angle-left" aria-hidden="true"></i><span>&nbsp;&nbsp;上一篇</span></a>
    </li>
    
    
    <li class="next">
      <a href="/20210904/make-your-windows-productive.html" title="让你的Windows更具生产力"><span>下一篇&nbsp;&nbsp;</span><i class="icon icon-angle-right" aria-hidden="true"></i></a>
    </li>
    
    
    <li class="toggle-toc">
      <a class="toggle-btn collapsed" data-toggle="collapse" href="#collapseToc" aria-expanded="false" title="文章目录" role="button">
        <span style="color:#C71585">[&nbsp;</span><span style="color:#C71585">文章目录</span>
        <i class="text-collapsed icon icon-anchor"></i>
        <i class="text-in icon icon-close"></i>
        <span style="color:#C71585">]</span>
      </a>
    </li>
    
  </ul>
  
  
  
  <div class="bar-right">
    
    <div class="share-component" data-sites="weibo,qq,wechat,facebook,twitter" data-mobile-sites="weibo,wechat,qq,qzone"></div>
    
  </div>
  </div>
</nav>
  


</main>

  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<footer class="footer" itemscope itemtype="http://schema.org/WPFooter">
	
	
    <ul class="social-links">
    	
        <li><a href="https://github.com/hwame" target="_blank" title="Github" data-toggle=tooltip data-placement=top><i class="icon icon-github"></i></a></li>
        
        <li><a href="https://weibo.com/hwamei" target="_blank" title="Weibo" data-toggle=tooltip data-placement=top><i class="icon icon-weibo"></i></a></li>
        
        <li><a href="https://www.zhihu.com/people/hwame" target="_blank" title="Zhihu" data-toggle=tooltip data-placement=top><i class="icon icon-zhihu"></i></a></li>
        
        <li><a href="https://segmentfault.com/u/hwame" target="_blank" title="Segmentfault" data-toggle=tooltip data-placement=top><i class="icon icon-segmentfault"></i></a></li>
        
        <li><a href="https://gitee.com/hwame" target="_blank" title="Gitee" data-toggle=tooltip data-placement=top><i class="icon icon-gitee"></i></a></li>
        
        <li><a href="/atom.xml" target="_blank" title="Rss" data-toggle=tooltip data-placement=top><i class="icon icon-rss"></i></a></li>
        
    </ul>

    <div class="copyright">
    	
        &copy; 2025 鴻塵
        
        
        <div class="publishby" style="font-family:Courier">
            <span id="busuanzi_container_site_pv">
                <i class="icon icon-eye"></i><span id="busuanzi_value_site_pv" style="font-family:Courier"></span>&nbsp;
                <i class="icon icon-users"></i><span id="busuanzi_value_site_uv" style="font-family:Courier"></span>
            </span>
            <!--
            <br>✯<a target="_blank" rel="noopener" href="https://beian.miit.gov.cn/" style="color:#0FFFAA">鄂ICP备2020019329号</a>
            -->
            <br><i class="icon icon-clock" style="transform:rotate(90deg)"></i><span id="sitetime" style="font-family:Courier"></span>
        </div>
        
        <!--
        <div class="publishby">
        	Theme by <a href="https://github.com/cofess" target="_blank"> cofess </a>base on <a href="https://github.com/cofess/hexo-theme-pure" target="_blank">pure</a>.
        </div>
        -->
    </div>
    
</footer>
<script>
    function siteTime(){
        window.setTimeout("siteTime()", 1000);
        var seconds = 1000;
        var minutes = seconds * 60;
        var hours = minutes * 60;
        var days = hours * 24;
        var years = days * 365;
        var today = new Date();
        var todayYear = today.getFullYear();
        var todayMonth = today.getMonth()+1;
        var todayDate = today.getDate();
        var todayHour = today.getHours();
        var todayMinute = today.getMinutes();
        var todaySecond = today.getSeconds();
        /* Date.UTC() -- 返回date对象距世界标准时间(UTC)1970年1月1日午夜之间的毫秒数(时间戳)
        year - 作为date对象的年份，为4位年份值
        month - 0-11之间的整数，做为date对象的月份
        day - 1-31之间的整数，做为date对象的天数
        hours - 0(午夜24点)-23之间的整数，做为date对象的小时数
        minutes - 0-59之间的整数，做为date对象的分钟数
        seconds - 0-59之间的整数，做为date对象的秒数
        microseconds - 0-999之间的整数，做为date对象的毫秒数 */
        var t1 = Date.UTC(2020,05,19,21,20,52); //建站时间
        var t2 = Date.UTC(todayYear,todayMonth,todayDate,todayHour,todayMinute,todaySecond);
        var diff = t2-t1;
        var diffYears = Math.floor(diff/years);
        var diffDays = Math.floor((diff/days)-diffYears*365);
        var diffHours = Math.floor((diff-(diffYears*365+diffDays)*days)/hours);
        var diffMinutes = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours)/minutes);
        var diffSeconds = Math.floor((diff-(diffYears*365+diffDays)*days-diffHours*hours-diffMinutes*minutes)/seconds);
        // 将「数字」转「补零字符串」
        var y = diffYears.toString()
        var d = diffDays.toString().padStart(3, '0')
        var h = diffHours.toString().padStart(2, '0')
        var m = diffMinutes.toString().padStart(2, '0')
        var s = diffSeconds.toString().padStart(2, '0')
        document.getElementById("sitetime").innerHTML=y+":"+d+":"+h+":"+m+":"+s;
    }
    siteTime();
</script>
  <script src="//cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="js/jquery.min.js"><\/script>')
</script>
<div id="go-top"></div>
<style type="text/css">
#go-top {
 width:40px;height:40px;
 background-color:#DDA0DD;
 position:relative;
 border-radius:20px;
 position:fixed;right:20px;bottom:50px;
 cursor:pointer;display:none;
}
#go-top:after {
 content:" ";
 position:absolute;left:14px;top:14px;
 border-top:2px solid #fff;border-right:2px solid #fff;
 width:12px;height:12px;
 transform:rotate(-45deg);
}
#go-top:hover {
 background-color:#8A2BE2;
}
</style>
<script>
$(function () {
  var top=$("#go-top");
  $(window).scroll(function () {
    ($(window).scrollTop() > 300) ? top.show(300) : top.hide(200);
    $("#go-top").click(function () {
      $('body,html').animate({scrollTop:0});
      return false();
    })
  });
});
</script>

<script src="/js/plugin.min.js"></script>


<script src="/js/application.js"></script>


    <script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: '标签',
            UNTITLED: '(未命名)',
        },
        ROOT_URL: '/',
        CONTENT_URL: '/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>

<script src="/js/insight.js"></script>





   




   
    

  <script src='/waline.js'></script>
  <link rel="stylesheet" type="text/css" href="/waline.css" />
  
  <script type="text/javascript">
 
  
Waline.init({
      el: '#vcomments',
      serverURL: 'https://waline.hwame.top',
});
  </script>

     


<!-- 20201211添加判断 -->

   
  <script src="//cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js"></script>
  <script>
  //利用 FancyBox 实现点击图片放大
  $(document).ready(function() {
    $('article img').not('[hidden]').not('.panel-body img').each(function() {
      var $image = $(this);
      var imageCaption = $image.attr('alt');
      var $imageWrapLink = $image.parent('a');
      if ($imageWrapLink.length < 1) {
        var src = this.getAttribute('src');
        var idx = src.lastIndexOf('?');
        if (idx != -1) {
          src = src.substring(0, idx);
        }
        $imageWrapLink = $image.wrap('<a href="' + src + '"></a>').parent('a');
      }
      $imageWrapLink.attr('data-fancybox', 'images');
      if (imageCaption) {
        $imageWrapLink.attr('data-caption', imageCaption);
      }
    });
    $().fancybox({
      selector: '[data-fancybox="images"]',
      hash: false,
      loop: true,
    });
  });
  </script>







  
  <style>
    .copy-btn {
      display: inline-block;
      padding: 6px 12px;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;
      color: #333;
      white-space: nowrap;
      vertical-align: middle;
      cursor: pointer;
      background-color: #eee;
      background-image: linear-gradient(#fcfcfc, #eee);
      border: 1px solid #d5d5d5;
      border-radius: 3px;
      user-select: none;
      outline: 0;
    }

    .highlight-wrap .copy-btn {
      transition: opacity .3s ease-in-out;
      opacity: 0;
      padding: 2px 6px;
      position: absolute;
      right: 4px;
      top: 8px;
      z-index: 2;
    }

    .highlight-wrap:hover .copy-btn,
        .highlight-wrap .copy-btn:focus {
      opacity: 1
    }

    .highlight-wrap {
      position: relative;
    }
  </style>
  
  <script>
    addLoadEvent(()=>{
      $('.highlight').each(function (i, e) {
        var $wrap = $('<div>').addClass('highlight-wrap')
        $(e).after($wrap)
        $wrap.append($('<button>').addClass('copy-btn').append('一键复制').on('click', function (e) {
          var code = $(this).parent().find(".code")[0].innerText
          
          var ta = document.createElement('textarea')
          document.body.appendChild(ta)
          ta.style.position = 'absolute'
          ta.style.top = '0px'
          ta.style.left = '0px'
          ta.value = code
          ta.select()
          ta.focus()
          var result = document.execCommand('copy')
          document.body.removeChild(ta)
          
            if(result)$(this).text('复制成功')
            else $(this).text('复制失败')
          
          $(this).blur()
        })).on('mouseleave', function (e) {
          var $b = $(this).find('.copy-btn')
          setTimeout(function () {
            $b.text('一键复制')
          }, 300)
        }).append(e)
      })
    })
  </script>

<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        tex2jax: {
            inlineMath: [ ["$","$"], ["\\(","\\)"] ],
            skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code'],
            processEscapes: true
        }
    });
    MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax();
        for (var i = 0; i < all.length; ++i)
            all[i].SourceElement().parentNode.className += ' has-jax';
    });
</script>
<script src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
</body>
</html>